#include <bits/stdc++.h>

using namespace std;

const int N = 510;
int m , k;
int b[N];
int s[N],e[N];

int check(int x){
    int t = -1,num = 0;
    int f = 0;
    for(int i = 1; i<=m; i++){
      if(x < b[i]) return 0;
      if(t < b[i])num+=1,t = x-b[i];
      else t-=b[i];
    }
    return num <= k;
}


int main()
{
    cin >> m >> k;
    for(int i = 1; i<=m ;i++)cin >> b[i];

    int l = 0, r = INT_MAX;
    int ans = 0;
    while(l < r){
        int mid = l + r + 1 >> 1;
        if(check(mid)){
            // cout << "ans:" << mid <<'\n';
            ans = mid,r = mid - 1;
        }
        else l = mid;
    }
    // cout << "ans:"<< ans<<"\n";
    // cout << check(17);

    // cout << "l:" <<l <<"\n";

    int tt = -1,j = k+1;
    for(int i = m; i>=0;i--){
       if(tt < b[i]) {
        e[--j] = i;
        s[j+1] = i+1;
        tt = ans - b[i];
       }else tt -= b[i];
    }
    s[1] = 1;
    for(int i = 1; i<= k; i++)
    cout << s[i] <<" " << e[i] <<'\n';

    
   
   return 0;
}
